#include "common.h"
#include "OS/os.h"
#include "uart.h"
#include "pwm.h"
#include "radio.h"
#include "sonar.h"



enum { A=1, B, C, D, E, F, G };
const unsigned int PT = 3;
const unsigned char PPP[] = {A,10,B,10,B,10};

void sonartask(){
	for(;;){
		getRange();
	}

}
int main(void)
{
 	int isCreated = 0;
 
	radio_init((uint8_t) 110, 0xABBA, 0 );

	init_pwm_motor(); //initialize the motor
	initTimer(); //initialize the sonar
	
	/* This should proabably be created as a task as it is the driving
	 *fucntion for the base station or it should be taken out and run only
	 *on the board for the base station. 
	 */

	 //base_main();
	 


	radio_print ("Initialized motor and sonar timers\n       ");
	
   	isCreated = Task_Create(pid, A, PERIODIC, A);
	radio_print("The pid task returned %d", isCreated);
   	Task_Create(sonartask, B, PERIODIC, B);
   return 0;
}
